<?php
// +----------------------------------------------------------------------
// | 幕小铺
// +----------------------------------------------------------------------
// | 版权所有 2016~2020 幕小铺科技（大连）有限公司
// +----------------------------------------------------------------------
// | 2020/03/14
// +----------------------------------------------------------------------

namespace app\erp\validate;
use think\Validate;

/**
 * 公共类 验证器 商品
 * @package app\admin\validate
 * @author shiqiang
 */
class Goods extends Validate
{
     protected $rule = [
		'goods_name'		        =>  'require',
        'goods_code' 		        =>  'require',
        'supplier_id' 		        =>  'require',
        'goods_classid' 		    =>  'require|array',
        'cover_video_arr' 		    =>  'require|array',
        'brand_id' 		            =>  'require',
        'unit_measurement' 		    =>  'require',
        'parameter' 		        =>  'require|array',
        'specifications' 		    =>  'require|array',
        'single_item' 		        =>  'require|array',
        'details_arr' 		        =>  'require|array',
        'user_id' 		            =>  'require',
        'goods_id' 		            =>  'require',
        'goods_classtempid' 		=>  'require',
    ];

    /* protected $message  =   [
        'title.require' 	=> '品牌名称不能为空',
        'title.unique' 	    => '品牌名称已存在',
        'sort'		        => '排序格式错误',
    ]; */

    //验证场景
    protected $scene = [
        'goods_list'=>  [//商品列表
            'user_id',
        ],
        'goods_delete'=>  [//商品删除
            'goods_id',
        ],
		'brand_edit'=>  [//编辑
            'title',
            'sort'
        ],
        'goods_info'=>  [//商品详情
            'goods_id',
        ],
        'goods_sku_info'=>  [//商品详情
            'goods_id',
        ],
        'goods_add'=>  [//商品添加
            'goods_name',
            'supplier_id',
            'goods_classid',
            'goods_classtempid',
            'cover_video_arr',//封面
            'brand_id',
            'unit_measurement',
            'parameter',
            //'specifications',
            'single_item',
            'details_arr'
            //'cover_video_arr',//供应商id
        ],

        'goods_edit'=>  [//商品添加
            'goods_name',
            'supplier_id',
            'goods_classid',
            'goods_classtempid',
            'cover_video_arr',//封面
            'brand_id',
            'unit_measurement',
            'parameter',
            //'specifications',
            'single_item',
            'details_arr'
            //'cover_video_arr',//供应商id
        ],
    ];
}
